/*
 * Image.h
 *
 *  Created on: 2012-10-18
 *      Author: yangentao@gmail.com
 */

#ifndef IMAGE_H_
#define IMAGE_H_
#include "headers.h"
#include "UiUtil.h"

//Bitmap will not release the hBitmap when destructor
//you need invoke the release() method to release the bitmap object
//release may throw exception if the bitmap object is inuse.
class Bitmap {
public:
	HBITMAP hBitmap;
public:
	Bitmap();
	Bitmap(HBITMAP hBmp);
	virtual ~Bitmap();
public:
	void create32(int width, int height, void* bits);
	HBITMAP discard();
	void release();
	bool enable();
	operator HBITMAP();
public:
	Size getSize();
	int getWidth();
	int getHeight();
};

#endif /* IMAGE_H_ */
